<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	function checkForm() {
		var dname = document.getElementById("dname").value;
		var price = document.getElementById("price").value;
		var img = document.getElementById("img").value;
		if (dname == null || dname == "") {
			document.getElementById("dnamerror").innerHTML = "类型不能为空！";
			return false;
		}
		if (price == null || price == "") {
			document.getElementById("priceerror").innerHTML = "地址不能为空！";
			return false;
		}
		if (img == null || img == "") {
			document.getElementById("imgerror").innerHTML = "圖片還沒選擇！";
			return false;
		}
		return true;
	}
</script>

<form class="upload-form"
	action="${pageContext.request.contextPath }/dish?action=update"
	method="post"  onsubmit="return checkForm()"  enctype="multipart/form-data">
	<h3>Edit Dish</h3>
	<input type="hidden" name="did" class="form-username form-control"
		id=did value="${dish.did }">
	<div class="form-group">
		<label>菜品名称</label> <input type="text" class="form-control" id="dname" name="dname"
			value=${dish.dname } placeholder="当前菜品名称"><span
			id="dnamerror" color="red"></span>
	</div>
	<div class="form-group">
		<label>价格</label> <input type="number" class="form-control" id="price" name="price"
			value=${dish.price } placeholder="当前菜品价格 "><span
			id="priceerror" color="red"></span>
	</div>
	<div class="form-group">
		<label>上传图片</label>
		<div class="row">
			<img class="col-md-3 merchant-cur-logo"
				src="/image${dish.img}"> <input
				type="file" id="img" name="img" class="col-md-9"><span
				id="imgerror" color="red"></span>
		</div>
	</div>
	<div class="form-group btn-center">
		<button type="submit" class="btn btn-primary sub-btn">保存</button>
		<button type="reset" class="btn btn-primary sub-btn">重置</button>
	</div>
</form>
</body>
</html>